
<div class="noprint">

<script type="text/javascript">
$(document).ready(function(){
	$("#tutto").click(function(){
        
		if($(this).attr('checked') == false)
        {
            $(this).parents('form').find("input[name*='mese']").attr('checked', false);
        }
        else
        {
            $(this).parents('form').find("input[name*='mese']").attr('checked', true);
        }
	});
});
</script>

<h1><?php echo $title; ?></h1>
<?php if (isset($notice) || $notice = $this->session->flashdata('notification')):?>
<p class="notice"><?php echo $notice;?></p>
<?php endif;?>

<?php if (count($rows) == 0) : ?>
<p class="notice"><?php echo __("Nessuno risultato", $module);?></p>
<?php endif; ?>

	<form method='post' action=''>

<fieldset style="width: 100%; margin: auto;">
<legend>Scelta</legend>
<label for="anno">
<input type="text" name="anno" value="<?php echo $anno ?>" />
</label>
<label for="tutto"><input type="checkbox" id="tutto" />Seleziona Tutti</label>

<?php for($i = 0; $i < 12; $i++): ?>
<label for="mese[<?php echo $i; ?>]" style="background-color: #EEEEEE;"> <input type="checkbox" id="mese[<?php echo $i; ?>]" name="mese[<?php echo $i; ?>]" value="<?php echo $i+1; ?>" <?php if(in_array($i+1,$arr_mese)): ?>checked="checked"<?php endif; ?> /><?php echo $nome_mese[$i+1] ?></label>
<?php endfor; ?>
<br />
<label for="id_rimesse">Rimessa :
<select name="id_rimesse"><option></option>
<?php foreach($rimesse as $r): ?>
<option value="<?php echo $r['id'] ?>" <?php if(isset($id_rimesse) && $id_rimesse == $r['id']) echo "selected"; ?>><?php echo $r['nome'] ?></option>
<?php endforeach; ?>
</select></label>
<label for="excel">Excel <input type="checkbox" name="excel" value="1" /></label> 
<label for="subcat">Visualizza Sottocategorie <input type="checkbox" name="subcat" value="1" <?php if($subcat) echo "checked='checked'"; ?>/></label> 
<input type="submit" name="go" value="  Visualizza  "/>

</fieldset>

</form>

</div>


<?php $k =1; foreach($rows as $categoria => $missioni): ?>
<h1 class="printonly"><?php echo $title; ?></h1>
	<table class='list'>
		<tr>
			<td></td>
		<?php foreach($arr_mese as $i): ?>
			<th><?php echo $nome_mese[$i]; ?></th>
		<?php endforeach; ?>
			<th><?php echo __("Totale", $module); ?></th>
		</tr>
		<tr><td colspan="14" style="background-color: lightgreen; border-bottom: 2px solid lightgreen; font-size: 15px; font-weight: bold;"><?php echo $categoria ?></td></tr>
		<?php foreach($missioni as $missione => $mesi): ?>
		<tr>
			<th width='22%' style='text-align:left;'><?php echo $missione; ?></th>
			<?php foreach($arr_mese as $i): ?>
				<td width='6%' align='right'><?php echo (isset($mesi[$i]))?format_euro($mesi[$i]):format_euro(0); ?></td>
			<?php endforeach; ?>
			<td width='8%' align='right' class='total'><?php echo format_euro(array_sum($mesi)); ?></td>
		</tr>
		<?php $k++; endforeach; ?>
	</table>
	<div style='page-break-before: always;'></div>	
<?php  endforeach; ?>
<h1 class="printonly"><?php echo $title; ?> </h1>
	<table class='form'><tr><th width='22%'><?php echo __("Totale Generale", $module) ?></th><td align="right" class="total"><?php echo format_euro($totale_generale) ?></td></tr></table>

